﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="IXION.BLOG.WEB.UI.Admin.Login" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script src="/js/jquery.js"></script>
    <link rel="icon" href="/images/favicon.ico" type="image/x-icon" />
    <link type="text/css" rel="stylesheet" href="/css/login.css" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div class="login">
            <h1><%= blog.BlogName %>后台管理登陆</h1>
            <fieldset id="inputs">
                <legend></legend>
                <input id="username" name="user.id" type="text" placeholder="请填写用户名" autofocus="autofocus" required="required" x-webkit-speech />
                <br />
                <input id="password" name="user.password" type="password" placeholder="请输入登录密码" required="required" x-webkit-speech />
            </fieldset>
            <fieldset id="actions" style="margin-left: 25%">
                <legend></legend>
                <input type="button" id="submit" value="登录" onclick="DoLogin();" />
                <input type="reset" id="reset" value="取消" />
            </fieldset>
        </div>
    </form>
    <script type="text/javascript">
        function DoLogin() {
            var userName = $("#username").val();
            var password = $("#password").val();
            $.post("/Admin/Handler/AdminActionHandler.ashx",
                { action: "Login", user: userName, password: password },
                function (info) {
                    if (info == "True") {
                        location.href = "./Default.aspx";
                        return true;
                    }
                    else if (info == "False") {
                        alert('密码不正确');
                    } else {
                        alert(info);
                    }
                })
        }
    </script>
</body>
</html>
